<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:include page="../include/admin/adminHeader.jsp" />
<jsp:include page="../include/admin/adminNavigator.jsp" />

<script>
	$(function(){
		$("#addForm").submit(function(){
			if(checkEmpty("name","属性名称"))
				return true;
			return false;
		});
	})
</script>

<title>属性管理</title>

<div class="workingArea">
	<ol class="breadcrumb">
		<li> <a href="admin_category_list">所有分类</a></li>
		<li> <a href="admin_property_list?category.id=${category.id}">${category.name}</a></li>
		<li class="active">属性管理</li>
	</ol>
	
	<div class="listDataTableDiv">
        <table
            class="table table-striped table-bordered table-hover  table-condensed">
            <thead>
                <tr class="success">
                    <th>ID</th>
                    <th>属性名称</th>
                    <th>编辑</th>
                    <th>删除</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${properties}" var="p">
 
                    <tr>
                        <td>${p.id}</td>
                        <td>${p.name}</td>
                        <td>
                        	<a href="admin_property_edit?property.id=${p.id}">
                        		<span class="glyphicon glyphicon-edit"></span>
                        	</a>
                        </td>
                        <td>
                        	<a deleteLink="true" href="admin_property_delete?property.id=${p.id}">
                            	<span class="glyphicon glyphicon-trash"></span>
                            </a>
                        </td>
 
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </div>
    
    <div class="pageDiv">
        <jsp:include page="../include/admin/adminPage.jsp" />
    </div>
    
    <div class="panel panel-warning addDiv">
        <div class="panel-heading">新增属性</div>
        <div class="panel-body">
            <form method="post" id="addForm" action="admin_property_add">
                <table class="addTable">
                    <tr>
                        <td>属性名称</td>
                        <td><input id="name" name="property.name" type="text"
                            class="form-control"></td>
                    </tr>
                    <tr class="submitTR">
                        <td colspan="2" align="center">
                            <input type="hidden" name="property.category.id" value="${category.id}">
                            <button type="submit" class="btn btn-success">提 交</button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>

<jsp:include page="../include/admin/adminFooter.jsp" />